package com.baizhi.service;

import com.baizhi.dao.LogDao;
import com.baizhi.entrty.Log;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class LogServiceImpl implements LogService {
    @Autowired
    private LogDao ld;
    @Override
    public Map fy(int page, int rows,String name) {
        int count = ld.getCount(name);
        int start = (page-1)*rows;

        List<Log> list = ld.getLog(start,rows,name);

        Map map = new HashMap();
        map.put("total",count);
        map.put("rows",list);

        return map;
    }

    @Override
    public void insert(Log log) {
        ld.insert(log);
    }

    @Override
    public void delete(int[] id) {
        ld.delete(id);
    }
}
